<?php
    session_start();
    $dir = dirname(dirname(dirname(__FILE__)));
    
    require_once $dir.'/movil/model/form/form.php';
    require_once $dir.'/templates/encuestaTemplate.php';    
    require_once $dir.'/lib_model/conexion.php';
    require_once $dir.'/lib_model/funciones.php';
    
    mysql_select_db($database_conexion);
  
    $k_username = $_SESSION["k_username"];
    $id_usuario = $_SESSION["id_usuario"];
    
    if(puede_ver($id_usuario)== false){
	echo '<SCRIPT LANGUAGE="javascript">location.href = "../../login/login.php?encuesta=model";</SCRIPT>';
    }
    
    $content = '<div id ="content">'.$encuesta.'</div>';  
    $dirFormsRendering = 'js/formsFunctions.js';
    $dirFormsRendering = '<script type="text/javascript" src="'.$dirFormsRendering.'"></script>';
    
    //include js
    $pageTemplate = str_replace('##JSPATH##', $dirFormsRendering, $template);
    
    //bluid page
    $body = str_replace('##BODY##', $content, $pageTemplate);
    
    echo $body;
?>